package com.hb.core.pojo.project.file.dto;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.hb.core.pojo.project.proj.entity.AbstractProject;
import com.hb.core.pojo.project.proj.entity.BidProject;
import com.hb.core.pojo.project.section.dto.BidSectionDTO;
import com.hb.core.pojo.project.section.entity.BidSection;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

/**
 * describe:
 * 招标文件编制vo
 *
 * @author zhongdl
 * @date 2021/09/16
 */
@Getter
@Setter
public class BidFileInfoEditDTO {

    /**
     * 标段信息
     */
    private BidSectionDTO bidSection;

    /**
     * 标段列表
     */
    private List<BidSection> bidSectionList;

    /**
     * 招标文件基本信息
     */
    private BidFileInfoDTO bidFileInfo;

    /**
     * fileId
     */
    private Long fileId;

    public String paramsValid() {
        if (this.getBidFileInfo() == null) {
            return "请添加招标文件编辑信息";
        }
        BidFileInfoDTO bidFileInfoDto = this.getBidFileInfo();
        if (StrUtil.isEmpty(bidFileInfoDto.getFileName())) {
            return "文件名称必填";
        }
        if (CollUtil.isEmpty(bidFileInfoDto.getBiddingDocument())) {
            return "请上传招标文件";
        }
        if (bidFileInfoDto.getBidEvaluationWay() == null) {
            return "评标办法必选";

        }
        if (bidFileInfoDto.getOfferWay() == null) {
            return "报价方式必选";
        }
        List<BidSection> bidSectionList = this.getBidSectionList();
        if (CollectionUtils.isEmpty(bidSectionList)) {
            return "请至少选择一个标段";

        }
        return null;
    }
}
